GtkImage: Simplify _set_from_icon_name
authorTimm Bäder <mail@baedert.org>
Wed, 30 Dec 2015 14:45:07 +0000 (15:45 +0100)
committerTimm Bäder <mail@baedert.org>
Sat, 2 Jan 2016 14:46:45 +0000 (15:46 +0100)
We don't need to strdup icon_name since that will happen in
_gtk_icon_helper_set_icon_name anyway.

gtk/gtkimage.c

index f9bd7e15eb54af49a56d846ef1f918f3c6a096ee..4ac0931996fb9d2074b713aeb97963c1c4aed950 100644 (file)
@@ -1223,7 +1223,6 @@ gtk_image_set_from_icon_name  (GtkImage       *image,
                               GtkIconSize     size)
 {
   GtkImagePrivate *priv;
-  gchar *new_name;
 
   g_return_if_fail (GTK_IS_IMAGE (image));
 
@@ -1231,18 +1230,14 @@ gtk_image_set_from_icon_name  (GtkImage       *image,
 
   g_object_freeze_notify (G_OBJECT (image));
 
-  new_name = g_strdup (icon_name);
   gtk_image_clear (image);
 
-  if (new_name)
-    {
-      _gtk_icon_helper_set_icon_name (priv->icon_helper, new_name, size);
-      g_free (new_name);
-    }
+  if (icon_name)
+    _gtk_icon_helper_set_icon_name (priv->icon_helper, icon_name, size);
 
   g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_NAME]);
   g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SIZE]);
-  
+
   g_object_thaw_notify (G_OBJECT (image));
 }